package com.king.cms.common;

import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
import org.apache.log4j.Logger;

public class SessionListener implements HttpSessionListener {
  private Logger logger=Logger.getLogger(this.getClass());

  private long count=0;
  public synchronized void sessionCreated(HttpSessionEvent se) {
    this.count=this.count+1; 
    se.getSession().getServletContext().setAttribute("count",this.count+"");
  }
  public synchronized void sessionDestroyed(HttpSessionEvent se) 
  {
    this.count=this.count-1;
    se.getSession().getServletContext().setAttribute("count",this.count+"");
  }
 }
